home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / totdoc.zip / CHAPT10.TXT < prev    next >
Text File  |  1991-02-11  |  28KB  |  723 lines

  1.                                                                       Displaying
  2.                                                                      Directories
  3.  
  4.  
  5.  
  6.          "An intellectual is someone who can listen to the William Tell overture
  7.          and not think of the Lone Ranger."
  8.  
  9.                                                                        Anonymous
  10.  
  11.  
  12.  
  13.          The Toolkit includes two entirely different object families for dis-
  14.          playing directory listings. The objects ListDirOBJ and ListDirSortOBJ
  15.          are descendant from ListOBJ and should be used when you want to display
  16.          the directory in a stretchable window, or let the user select multiple
  17.          files. The DirWinOBJ should be used when you want to display a file
  18.          selection dialog box and allow the user to choose a single file.
  19.  
  20.  
  21. Displaying Directory List Windows
  22.  
  23.          The totLIST unit includes the ListDirOBJ object which is an adaptation
  24.          of ListOBJ. ListDirOBJ is designed to display files and directories in
  25.          a stretchable window. ListDirOBJ is a descendant of ListOBJ, and inher-
  26.          its all the following ListOBJ methods:
  27.                     Init
  28.                     SetTopPick
  29.                     SetActivePick
  30.                     SetTagging
  31.                     SetColWidth
  32.                     Show
  33.                     Go
  34.                     LastKey
  35.                     GetHiString
  36.                     Win^
  37.                     Done
  38.  
  39.          Some of the list defaults are influenced by LookTOT^ methods. Refer
  40.          back to page 9-20 for a full description of these methods.
  41.          In addition to the inherited methods, ListDirOBJ includes the following
  42.          important method:
  43.  
  44.  
  45.          ReadFiles(Filemasks:string; FileAttrib:word);
  46.          This method must be called before the Go method. ReadFiles instructs
  47.          the object to read all the files matching the first parameter. The
  48.          filemask should include wild cards, e.g. *.pas, *.*, bob?.tit, etc.,
  49.          and may optionally include a drive and path. If a drive/path is not
  50.          specified, all matching files in the default directory will be read.
  51.          Note that the string may include more than one file specification sepa-
  52.          rated by spaces, e.g. '*.pas *.asm'. The second parameter identifies
  53.          the attributes of the files to include in the list.
  54.  
  55. 10-2                                                                User's Guide
  56. --------------------------------------------------------------------------------
  57.  
  58.          The Turbo Pascal DOS unit includes the following file attribute con-
  59.          stants:
  60.  
  61.                     ReadOnly        = $01
  62.                     Hidden          = $02
  63.                     SysFile         = $04
  64.                     VolumeID        = $08
  65.                     Directory       = $10
  66.                     Archive         = $20
  67.                     AnyFile         = $3F
  68.          Specify any of the desired file types by summing these constants and
  69.          passing them as the second parameter. For example, the following method
  70.          call will list all the .TXT files that can be edited:
  71.  
  72.                   ReadFiles('*.TXT',Anyfile-ReadOnly-Hidden);
  73.          Note that the Toolkit automatically removes the VolumeID file from the
  74.          list.
  75.  
  76.          In summary, to display a basic file listing, all you have to do is
  77.          declare an instance of ListDirOBJ, and then call the methods Init,
  78.          ReadFiles and Go. The chosen file can be determined by calling the
  79.          function method GetHiString. Listed below is the demo file DEMDR1.PAS
  80.          which displays a simple directory, followed by figure 10.1 showing the
  81.          resultant list.
  82.  
  83.  
  84.          program DemoDirectoryOne;
  85.          {demdr1 - the default directory list}
  86.          Uses DOS, CRT,
  87.               totFAST, totLIST;
  88.  
  89.          Var
  90.             ListWin:  ListDirObj;
  91.          begin
  92.             Screen.Clear(white,'░'); {paint the screen}
  93.             with ListWin do
  94.             begin
  95.                Init;
  96.                ReadFiles('*.*',AnyFile);
  97.                Go;
  98.                Win^.Remove;
  99.                if (LastKey = 27) or (Lastkey = 600) then
  100.                   writeln('You escaped!')
  101.                Else
  102.                   writeln('You chose file '+GetHiString);
  103.                Done;
  104.             end;
  105.          end.
  106.  
  107.  
  108.  
  109.  
  110. Displaying Directories                                                      10-3
  111. --------------------------------------------------------------------------------
  112.  
  113. Figure 10.1                                                             [SCREEN]
  114. A Basic Directory
  115. List
  116.  
  117.  
  118. Determining Tagged Files
  119.  
  120.          By default, the user can select multiple files by hitting the [KEYCAP]
  121.          or clicking the left mouse button on a filename. The method SetTagging
  122.          can be used to enable or disable multiple file tagging.
  123.          The ListDirOBJ object implements the methods GetStatus and SetStatus to
  124.          provide access to tagged files. These methods work in precisely the
  125.          same way as their namesakes in the DLLOBJ family. Full descriptions can
  126.          be found on page 9-27, but in brief, GetStatus returns a boolean to
  127.          indicate whether the file has been tagged, and is passed two parame-
  128.          ters; the first parameter is the number of the file in the list, and
  129.          the second is the flag ID which should be set to 0 (zero) to check the
  130.          status of the tag flag.
  131.  
  132.          Each ListDirOBJ instance includes a FileDLLOBJ object which is a linked
  133.          list holding all the file details. The ListDirOBJ object provides the
  134.          method FileList which returns a pointer to the FileDLLOBJ list. This is
  135.          useful when you want to directly manipulate the file linked list. You
  136.          may recall that all DLLOBJ objects have a method TotalNodes which
  137.          returns a longint identifying the number of entries in the list. The
  138.          ListDirOBJ method FileList^.TotalNodes therefore returns the total num-
  139.          ber of files in the list.
  140.          The demo program DEMDR2.PAS, listed below, shows how the methods GetS-
  141.          tatus and FileList^.TotalFiles can be used to ascertain which files the
  142.          user tagged. Notice that you must access the tagged files before
  143.          calling the method Done - otherwise, the list will be disposed of
  144.          before you can access it! Following the listing are figures 10.2 and
  145.          10.3 which provide an example of the output generated by the program.
  146.          Note that the highlighted file will only be included in the list if the
  147.          file is tagged.
  148.  
  149.          program DemoDirectoryTwo;
  150.          {demdr2 - determining chosen files}
  151.          Uses DOS, CRT,
  152.               totFAST, totLIST;
  153.  
  154.          Var
  155.             ListWin:  ListDirObj;
  156.             Tot,L:longint;
  157.          begin
  158.             Screen.Clear(white,'░'); {paint the screen}
  159.             with ListWin do
  160.             begin
  161.  
  162.  
  163.  
  164.  
  165. 10-4                                                                User's Guide
  166. --------------------------------------------------------------------------------
  167.  
  168.                Init;
  169.                ReadFiles('*.*',AnyFile);
  170.                Go;
  171.                Win^.Remove;
  172.                if (LastKey = 27) or (Lastkey = 600) then
  173.                   writeln('You escaped!')
  174.                Else
  175.                begin
  176.                   writeln('The highlighted file was '+GetHiString);
  177.                   writeln('The tagged files were: ');
  178.                   Tot := FileList^.TotalNodes;
  179.                   for L := 1 to Tot do
  180.                       if GetStatus(L,0) then
  181.                          writeln(GetString(L,0,0));
  182.                end;
  183.                Done;
  184.             end;
  185.          end.
  186.  
  187.  
  188.  
  189. Figure 10.2                                                             [SCREEN]
  190. Tagging Multiple
  191. Files
  192.  
  193. Figure 10.3                                                             [SCREEN]
  194. Displaying the
  195. Tagged Files
  196.  
  197.  
  198. Advanced Directory Management
  199.  
  200.          In the previous section you learned that the method FileList returns a
  201.          pointer to an instance of type FileDLLOBJ which contains a list of all
  202.          the files selected for display. In addition to the TotalNodes method,
  203.          you can call any of the other FileDLLOBJ methods. Remember that these
  204.          methods must be called via the FileList method using the syntax:
  205.                   FileList^.method
  206.  
  207.  
  208. Sorting
  209.  
  210.          The Sort method can be used to sort the directory listing. This method
  211.          is described on page 9-6, and has the following syntax:
  212.                   FileList^.Sort(SortID:shortint;Ascending:boolean);
  213.  
  214.          When used with a FileDLLOBJ object, the first parameter instructs the
  215.          Toolkit about which element of the file to sort by. The permissible
  216.          values are as follows:
  217.  
  218.  
  219.  
  220. Displaying Directories                                                      10-5
  221. --------------------------------------------------------------------------------
  222.  
  223.               0     DOS (unsorted)
  224.               1     Name
  225.               2     Ext
  226.               3     Size
  227.               4     Time
  228.  
  229.          For example, calling the method Sort(2,false) will sort the files by
  230.          filename extension in descending order.
  231.  
  232.  
  233. Accessing File Details
  234.  
  235.          The totLINK unit includes the following type declaration:
  236.                   tFileInfo = record
  237.                      Filename: string[12];
  238.                      Attr: byte;
  239.                      Time:longint;
  240.                      Size:longint;
  241.                      LoadID: longint;
  242.                   end;
  243.  
  244.          Every node in a FileDLLOBJ list contains such a record, describing all
  245.          the file details. The first four fields in the record are the same as
  246.          the corresponding fields in the Turbo Pascal SearchRec record. The
  247.          fifth record LoadID is the node number when the file was added to the
  248.          list. This field is required so the list can be sorted in DOS order,
  249.          i.e. the order in which the files are stored in the DOS directory.
  250.          The FileDLLOBJ method GetFileRecord can be used to access a file's
  251.          record, and the method GetLongStr can be used to access a string
  252.          detailing the file information. The syntax of these methods is as fol-
  253.          lows:
  254.  
  255.  
  256.          FileList^.GetFileRecord(var Info:tFileInfo; NodeNumber:longint);
  257.          The first parameter must be a variable of type tFileInfo. This variable
  258.          is updated with the file details for the file specified by the second
  259.          parameter.
  260.  
  261.  
  262.          FileList^.GetLongStr(Node:DLLNodePtr): string;
  263.          This method is passed a pointer to the list node, and returns a for-
  264.          matted string representing the node's file details. Remember that the
  265.          method FileList^.NodePtr can be used to return a node pointer.
  266.  
  267.  
  268.  
  269. 10-6                                                                User's Guide
  270. --------------------------------------------------------------------------------
  271.  
  272. Refreshing the File List
  273.  
  274.          In the last chapter you learned that you can intercept all characters
  275.          pressed while a list is active, by assigning a character hook, or by
  276.          creating a descendant method and replacing the virtual method CharTask.
  277.          Thanks to OOP inheritance, these techniques can also be used with List-
  278.          DirOBJ objects.
  279.          The FileList linked list can be directly modified using some FileDLLOBJ
  280.          methods. Ordinarily, you wouldn't need to call these methods, but if
  281.          you want to modify the displayed list "on the fly" from a character
  282.          hook, you can use the following methods:
  283.  
  284.  
  285.          FileList^.GetFileMask:string;
  286.          This function returns the currently active file mask.
  287.  
  288.  
  289.          FileList^.SetFileDetails(FileMasks:string; FileAttrib:word);
  290.          Specifies a new set of file masks and file attributes. This method must
  291.          be called prior to FillList.
  292.  
  293.  
  294.          FileList^.FillList;
  295.          Empties the list (if it already contains files), and re-populates the
  296.          list with the new category of files.
  297.  
  298.  
  299.          FileList^.FillNewMask(Filemasks:string);
  300.          This method re-populates the list with all files matching the FileMasks
  301.          parameter, which have the same attributes that were used when the list
  302.          was last filled.
  303.  
  304.  
  305.  
  306. Example
  307.          The demo program DEMDR3.PAS, listed below, illustrates some of the
  308.          techniques discussed in this section. Figure 10.4 shows the resultant
  309.          output.
  310.  
  311.          program DemoDirectoryThree;
  312.          {demdr3 - a customized directory list}
  313.          Uses DOS, CRT,
  314.               totFAST, totLINK, totLIST;
  315.  
  316.          Var
  317.             ListWin:  ListDirObj;
  318.             FileInfo: tFileInfo;
  319.  
  320.  
  321.  
  322. Displaying Directories                                                      10-7
  323. --------------------------------------------------------------------------------
  324.  
  325.          begin
  326.             Screen.Clear(white,'░'); {paint the screen}
  327.             with ListWin do
  328.             begin
  329.                Init;
  330.                SetTagging(false);
  331.                ReadFiles('*.*',AnyFile - directory); {exclude directories}
  332.                FileList^.Sort(1,true);               {sort in name order}
  333.                Win^.SetTitle(' Choose a file ');
  334.                Go;
  335.                Win^.Remove;
  336.                if (LastKey = 27) or (Lastkey = 600) then
  337.                   writeln('You escaped!')
  338.                Else
  339.                begin
  340.                   writeln('You chose file '+GetHiString);
  341.                   writeln(FileList^.GetLongStr(FileList^.ActiveNodePtr));
  342.                   FileList^.GetFileRecord(FileInfo,
  343.                                           FileList^.ActiveNodeNumber);
  344.                   with FileInfo do
  345.                   begin
  346.                      writeln('Name:           ', FileName);
  347.                      writeln('Attr:           ', Attr);
  348.                      writeln('Packed Time:    ', Time);
  349.                      writeln('Size:           ', Size);
  350.                      writeln('Directory entry:',LoadID);
  351.                   end;
  352.                end;
  353.                Done;
  354.             end;
  355.          end.
  356.  
  357.  
  358.  
  359. Figure 10.4                                                             [SCREEN]
  360. Advanced Directory
  361. Control
  362.  
  363.  
  364.  
  365. Displaying Sortable Directories
  366.          ListDirSortOBJ is a descendant of ListDirOBJ, and shares all the meth-
  367.          ods of its ancestor. ListDirSort works in just the same way as ListDi-
  368.          rOBJ, with one added bonus - the user can press the right mouse button
  369.          or [KEYCAP] to display a sort dialog box. This allows the end user to
  370.          sort the file list in any order.
  371.  
  372.          Listed below is the demo program DEMDR4.PAS, followed by figure 10.5
  373.          showing the sort dialog box.
  374.  
  375.  
  376. 10-8                                                                User's Guide
  377. --------------------------------------------------------------------------------
  378.  
  379.          program DemoDirFour;
  380.          {demdr4 - a user sortable directory listing}
  381.  
  382.          Uses DOS, CRT,
  383.               totFAST, totLIST;
  384.          Var
  385.             ListWin:  ListDirSortOBJ;
  386.  
  387.          begin
  388.             Screen.Clear(white,'░'); {paint the screen}
  389.             Screen.WriteCenter(25,white,' Press S or Right Mouse Button
  390.                                           for Sort Options ');
  391.             with ListWin do
  392.             begin
  393.                Init;
  394.                ReadFiles('*.*',AnyFile);
  395.                Go;
  396.                Done;
  397.             end;
  398.          end.
  399.  
  400.  
  401.  
  402. Figure 10.5                                                             [SCREEN]
  403. The Sort Dialog
  404. Box
  405.  
  406.  
  407.  
  408. Displaying Directories                                                      10-9
  409. --------------------------------------------------------------------------------
  410.  
  411. Displaying a Directory Dialog Window
  412.  
  413.          In the unit totDIR, the Toolkit provides an alternative object for
  414.          displaying a directory dialog box. Figure 10.6 shows how the dialog box
  415.          looks to the user. The display is generated using a DirWinOBJ, and it
  416.          is ideal for prompting the user to enter a filename.
  417.          The user can enter a file name, or a file mask, into the filename
  418.          field. If a file mask is entered, the file list is automatically
  419.          updated to reflect the new mask. The user can move from field to field
  420.          by pressing the [KEYCAP] and [KEYCAP] keys. As in the Turbo 6 environ-
  421.          ment, the user can choose a file from the file list by cursoring to the
  422.          desired file and pressing [KEYCAP]. The user can change directories or
  423.          drives by tabbing to the directory list, highlighting the desired
  424.          directory, and pressing [KEYCAP]. The user can also tab to the buttons
  425.          and select OK, Cancel or Help. Alternatively, the buttons can be
  426.          selected by pressing one of the hotkeys [KEYCAP], [KEYCAP] or [KEYCAP].
  427.  
  428.          A mouse user simply clicks on a field to activate it, and double-clicks
  429.          to choose a specific file or directory.
  430.  
  431.  
  432. Figure 10.6                                                             [SCREEN]
  433. A Pop-up Directory
  434. Window
  435.  
  436.  
  437. Displaying a Basic Directory Window
  438.          The DirWinOBJ is very easy to use, and has the following four main
  439.          methods:
  440.  
  441.  
  442.          Init;
  443.          As always, this methods initializes the instance and must always be
  444.          called first.
  445.  
  446.  
  447.          Go:tAction;
  448.          This is the "do it" method which instructs the Toolkit to display the
  449.          dialog window and wait for the user to choose a file. Go returns a
  450.          member of the enumerated type tAction to indicate whether the user
  451.          chose a file or escaped. This function will only return Finished or
  452.          Escaped.
  453.  
  454.  
  455.          GetChosenFile:string;
  456.  
  457.  
  458.  
  459. 10-10                                                               User's Guide
  460. --------------------------------------------------------------------------------
  461.  
  462.          This function method should be called after Go, to determine which file
  463.          the user selected. The function returns the name the user entered in
  464.          the input field, or the active filename in the file list. Note you
  465.          should check the value returned by Go to check whether the user
  466.          escaped.
  467.  
  468.  
  469.          Done;
  470.          This function should be called to dispose of the instance, and should
  471.          be called after the method GetChosenFile.
  472.  
  473.  
  474.          Listed below is the program DEMDR5.PAS which generated the display
  475.          shown in figure 10.6.
  476.          program DemoDirFive;
  477.          {demdr5 - the directory dialog box}
  478.  
  479.          Uses DOS, CRT,
  480.               totFAST, totDir, totIO1;
  481.          Var
  482.             DirWin: DirWinObj;
  483.             Result: tAction;
  484.          begin
  485.             Screen.Clear(white,'░'); {paint the screen}
  486.             with DirWin do
  487.             begin
  488.                Init;
  489.                Result := Go;
  490.                if Result = Finished then
  491.                   writeln('You chose file: ',GetChosenFile)
  492.                else
  493.                   writeln('You escaped!');
  494.                Done;
  495.             end;
  496.          end.
  497.  
  498.  
  499. Customizing the Window
  500.  
  501.          To provide further display control, the DirWinOBJ object also includes
  502.          the following customization methods:
  503.  
  504.          SetFileDetails(StartDir:string; FileMasks:string; FileAttrib: word);
  505.  
  506.          By default, the Toolkit will display any file with a mask of '*.*' in
  507.          the default directory. Use this method to override the defaults. The
  508.          first parameter specifies the initial drive and directory to search.
  509.          The second parameter identifies the file mask which may include multi-
  510.  
  511.  
  512.  
  513. Displaying Directories                                                     10-11
  514. --------------------------------------------------------------------------------
  515.  
  516.          ple file masks separated by spaces, e.g. '*.bat *.exe *.com'. The third
  517.          parameter specifies the attributes of the files to be included in the
  518.          list (see the file attribute list on page 10.2).
  519.  
  520.  
  521.          SetSortDetails(SortID:byte; SortOrder: boolean);
  522.          Ordinarily, the files are sorted in name order. Use this method to
  523.          specify an alternate sort order. Refer to the sorting discussion on
  524.          page 10.5 for further information.
  525.  
  526.  
  527.          Win^:MoveWinPtr;
  528.          The method Win returns a pointer to the MoveWinOBJ instance on which
  529.          the window is drawn. By calling any MoveWinOBJ method using the syntax
  530.          Win^.method, you control the appearance of the window.
  531.  
  532.  
  533.  
  534.            Note: the DirWinOBJ is a hybrid of a number of other Toolkit
  535.            objects, and the way to control all the colors is not obvious. The
  536.            overall background, title, box border and file details are con-
  537.            trolled by the window, and the color is set with the method
  538.            Win^.SetColors. All other aspects of the dialog box are controlled
  539.            by the object IOTOT. The following IOTOT methods control the
  540.            directory display colors:
  541.  
  542.                     IOTOT^.SetColLabel (changes the box labels, e.g. Name:)
  543.                     IOTOT^.SetColList (changes the file and dir lists)
  544.                     IOTOT^.SetColField (changes the filename input field
  545.                     IOTOT^.SetColButtons (changes the buttons)
  546.  
  547.            IOTOT is discussed fully in the next chapter.
  548.  
  549.  
  550.  
  551.          Listed below is the demo program DEMDR6.PAS which illustrates how to
  552.          customize the directory display using the above methods, and figure
  553.          10.7 shows the resultant output:
  554.          program DemoDirSix;
  555.          {demdr6 - customizing the directory dialog box}
  556.  
  557.          Uses DOS, CRT,
  558.               totFAST, totDir, totIO1;
  559.          Var
  560.             DirWin: DirWinObj;
  561.             Result: tAction;
  562.          begin
  563.             Screen.Clear(white,'░'); {paint the screen}
  564.  
  565.  
  566.  
  567.  
  568. 10-12                                                               User's Guide
  569. --------------------------------------------------------------------------------
  570.  
  571.             with DirWin do
  572.             begin
  573.                Init;
  574.                SetFileDetails('','*.EXE *.COM *.BAT',AnyFile);
  575.                SetSortDetails(2,true);
  576.                Win^.SetColors(15,15,15,11);
  577.                IOTOT^.SetColLabel(15,15,15,15);
  578.                IOTOT^.SetColList(7,7,112,112);
  579.                IOTOT^.SetColField(7,112,8,8);
  580.                IOTOT^.SetColButton(112,126,127,126);
  581.                Result := Go;
  582.                if Result = Finished then
  583.                   writeln('You chose file: ',GetChosenFile)
  584.                else
  585.                   writeln('You escaped!');
  586.                Done;
  587.             end;
  588.          end.
  589.  
  590.  
  591. Figure 10.7                                                             [SCREEN]
  592. Customizing the
  593. Directory Window
  594.  
  595.  
  596.  
  597. On-Screen Help
  598.          By default, the Help key displays a simple message window describing
  599.          how to select a file (see figure 10.8). You can substitute your own
  600.          help dialog if necessary.
  601.  
  602.  
  603. Figure 10.8                                                             [SCREEN]
  604. The Default Help
  605. Display
  606.  
  607.  
  608.          In the next chapter, you will learn all about the Toolkit's very power-
  609.          ful full screen input facility. The totDIR unit makes extensive use of
  610.          the totIO units to build the directory dialog box. To override the
  611.          default directory help, you need to access the full screen input man-
  612.          ager object. You will be very familiar with the manager by the end of
  613.          the next chapter, but for now, all you need to concentrate on is the
  614.          help facility.
  615.  
  616.          The DirWinOBJ object includes the function method Action which returns
  617.          a pointer to the dialog manager. By calling the dialog manager's own
  618.          method SetHelpHook, you can assign a special procedure to be called
  619.          when the user asks for help.
  620.  
  621.  
  622. Displaying Directories                                                     10-13
  623. --------------------------------------------------------------------------------
  624.  
  625.          To create customized help, all you have to do is create a procedure
  626.          following some specific rules, and then call the DirWinOBJ method
  627.          Action^.SetHelpHook to instruct the Toolkit to use your procedure.
  628.  
  629.          For a procedure to be eligible as a help hook, it must adhere to the
  630.          following rules:
  631.          Rule 1     The procedure must be declared as a FAR procedure. This can
  632.                     be achieved by preceding the procedure with a {$F+} compiler
  633.                     directive, and following the procedure with a {$F-} direc-
  634.                     tive. Alternatively, Turbo 6 users can use the new keyword
  635.                     FAR following the procedure statement.
  636.  
  637.          Rule 2     The procedure must be declared with one passed parameter of
  638.                     type word. This parameter indicates which field was high-
  639.                     lighted when help was pressed. The directory dialog fields
  640.                     have the following IDs:
  641.                           1     File mask field
  642.                           2     File list field
  643.                           3     Directory list field
  644.                           4     OK button
  645.                           5     Cancel button
  646.                           65335 Help button (constant HelpID)
  647.  
  648.          Rule 3     The procedure must be at the root level, i.e. the procedure
  649.                     cannot be nested within another procedure.
  650.          The following procedure declaration follows these rules:
  651.  
  652.                   {$F+}
  653.                   procedure MyHelpHook(ID:word);
  654.                   .....{procedure statements}
  655.                   end;
  656.                   {$F-}
  657.  
  658.          The following method Action^.SetHelpHook is then called to instruct the
  659.          Toolkit to call your procedure when the user asks for help:
  660.  
  661.  
  662.          Action^.SetHelpHook(PassedProc:HelpProc);
  663.          This method is passed the procedure name of a procedure declared using
  664.          the rules outlined above.
  665.  
  666.  
  667.          The demo program DEMDR7.PAS, listed below, illustrates how to customize
  668.          the directory help. Figure 10.9 shows the help screen!
  669.  
  670.          program DemoDirSeven;
  671.          {demdr7 - customizing directory help}
  672.  
  673.  
  674.  
  675.  
  676. 10-14                                                               User's Guide
  677. --------------------------------------------------------------------------------
  678.  
  679.          Uses DOS, CRT,
  680.               totFAST, totDir, totIO1, totMSG;
  681.  
  682.          Var
  683.             DirWin: DirWinObj;
  684.             Result: tAction;
  685.          {$F+}
  686.          procedure NewHelp(ID:word);
  687.          {}
  688.          var  HelpWin: MessageOBJ;
  689.          begin
  690.             with HelpWin do
  691.             begin
  692.                Init(1,' Not Much Help ');
  693.                AddLine('');
  694.                Addline(' Honey, if you need help here, we got big problems! ');
  695.                AddLine('');
  696.                Show;
  697.                Done;
  698.             end;
  699.          end; {NewHelp}
  700.          {$F-}
  701.  
  702.          begin
  703.             Screen.Clear(white,'░'); {paint the screen}
  704.             with DirWin do
  705.             begin
  706.                Init;
  707.                Action^.SetHelpHook(NewHelp);
  708.                Result := Go;
  709.                if Result = Finished then
  710.                   writeln('You chose file: ',GetChosenFile)
  711.                else
  712.                   writeln('You escaped!');
  713.                Done;
  714.             end;
  715.          end.
  716.  
  717.  
  718. Figure 10.9                                                             [SCREEN]
  719. Customized Help
  720.  
  721.  
  722.  
  723.